<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>测试API</title>
<style type="text/css">
</style>
</head>
<body>
	<table
		class="am-table am-table-bd am-table-striped admin-content-table">
		<caption>系统测试工具</caption>
		<tbody>
			<tr data-url="/web/sys/util/decodepwd.json">
				<td>解码密码</td>
				<td><input name="cyphered" type="text"/></td>
				<td><button class="am-btn am-btn-danger" type="button">确定</button></td>
			</tr>
			<tr style='display: none; background: #F37B1D'>
				<td colspan='3'>hidden</td>
			</tr>
			
			<tr data-url="/web/sys/util/encodeacctxt.json">
				<td>账号加密</td>
				<td><input name="acctxt" type="text" placeholder="acctype:accvalue:pwd"/><input name="os" type="text" placeholder="i/a"/><input name="ver" type="text" placeholder="5位以上整数"/></td>
				<td><button class="am-btn am-btn-danger" type="button">确定</button></td>
			</tr>
			<tr style='display: none; background: #F37B1D'>
				<td colspan='3'>hidden</td>
			</tr>
		</tbody>
	</table>
	<script type="text/javascript">
	jQuery(function($) {
		$(".am-btn-danger").click(function(){
			 var $tr = $(this).closest("tr");
			 var url=$tr.data("url");
			 var $inputs=$("input[type='text']",$tr);
			 var data={};
			 $inputs.each(function(item){
				var $this=$(this);
				data[$this.attr('name')]=$this.val();
			 });
			 $.get(ctx+url,data).success(function(json) {
				 $nexttr=$tr.next();
				 if(json.c==0){
					 $nexttr.html(json.d);
				}else{
					$nexttr.html(json.m);
				}
				 $nexttr.show();
			 });
		});
	});
	</script>
</body>
</html>